<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template piecewise_constant_distribution</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../boost_random/reference.html#doxygen.headers.piecewise__constant__distribution_8hpp" title="Header &lt;boost/random/piecewise_constant_distribution.hpp&gt;">
<link rel="prev" href="classboost_1_1random_1_1normal__distribution_1_1param__type.html" title="Class param_type">
<link rel="next" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="classboost_1_1random_1_1normal__distribution_1_1param__type.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_random/reference.html#doxygen.headers.piecewise__constant__distribution_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template piecewise_constant_distribution</span></h2>
<p>boost::random::piecewise_constant_distribution</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../boost_random/reference.html#doxygen.headers.piecewise__constant__distribution_8hpp" title="Header &lt;boost/random/piecewise_constant_distribution.hpp&gt;">boost/random/piecewise_constant_distribution.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> RealType <span class="special">=</span> <span class="keyword">double</span><span class="special">,</span> <span class="keyword">typename</span> WeightType <span class="special">=</span> <span class="keyword">double</span><span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1aa6069a8e601ceb503312c5d7d628e7e8"></a><span class="identifier">input_type</span><span class="special">;</span> 
  <span class="keyword">typedef</span> <span class="identifier">RealType</span>    <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a6f988323eda87a4e3f064bd06d748424"></a><span class="identifier">result_type</span><span class="special">;</span>

  <span class="comment">// member classes/structs/unions</span>

  <span class="keyword">class</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">{</span>
  <span class="keyword">public</span><span class="special">:</span>
    <span class="comment">// types</span>
    <span class="keyword">typedef</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1a2a3065fc0346e37b2b48f748e409ff7b"><span class="identifier">distribution_type</span></a><span class="special">;</span>

    <span class="comment">// <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#id-1_3_32_5_6_34_1_1_1_3_2-bb">friend functions</a></span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> CharT<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span> 
      <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span> 
      <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1a36d2820c7e758fa1a94fdd5d74949e54"><span class="keyword">operator</span><span class="special">&lt;&lt;</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> CharT<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span> 
      <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span> 
      <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1aa94ff75dd5871ee80a6fc0a095c75bd0"><span class="keyword">operator</span><span class="special">&gt;&gt;</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
    <span class="keyword">bool</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1ae6f3b58e629ce7a54b5e18a4f05dbc5a"><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
    <span class="keyword">bool</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1aa559d0d98e88e84417364a89b83cf5b2"><span class="keyword">operator</span><span class="special">!=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>

    <span class="comment">// <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#id-1_3_32_5_6_34_1_1_1_3_3-bb">public member functions</a></span>
    <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1a7f85fafd7eb31e9fe8d1fbd81c4461df"><span class="identifier">param_type</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> IntervalIter<span class="special">,</span> <span class="keyword">typename</span> WeightIter<span class="special">&gt;</span> 
      <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1aff82023c551dd23a00593f024ed83fd3"><span class="identifier">param_type</span></a><span class="special">(</span><span class="identifier">IntervalIter</span><span class="special">,</span> <span class="identifier">IntervalIter</span><span class="special">,</span> <span class="identifier">WeightIter</span><span class="special">)</span><span class="special">;</span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> F<span class="special">&gt;</span> 
      <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1acbe3ff34f267e57b9cdce8abddf12fd3"><span class="identifier">param_type</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">F</span><span class="special">)</span><span class="special">;</span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> IntervalRange<span class="special">,</span> <span class="keyword">typename</span> WeightRange<span class="special">&gt;</span> 
      <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1a41e91efa9a22a61f97f186340aa3d626"><span class="identifier">param_type</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">IntervalRange</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">WeightRange</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1adefe4ad99ec78042dfe301a7e9fe821e"><span class="identifier">param_type</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">,</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">F</span><span class="special">)</span><span class="special">;</span>
    <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">RealType</span> <span class="special">&gt;</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1ad3f17f5c5ffb0725c494a453e840b5c3"><span class="identifier">intervals</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
    <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">RealType</span> <span class="special">&gt;</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type_1a17d55affa383872ad7ad0f32245d8f27"><span class="identifier">densities</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="special">}</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#id-1_3_32_5_6_34_1_1_1_6-bb">public member functions</a></span>
  <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a76797fda1e5f8ae0f6f833e542a42f71"><span class="identifier">piecewise_constant_distribution</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> IntervalIter<span class="special">,</span> <span class="keyword">typename</span> WeightIter<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1acce63ef0ad9d3e70e7e36148990341f5"><span class="identifier">piecewise_constant_distribution</span></a><span class="special">(</span><span class="identifier">IntervalIter</span><span class="special">,</span> <span class="identifier">IntervalIter</span><span class="special">,</span> <span class="identifier">WeightIter</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> F<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1abd80a326c224151118e703771a1c4ade"><span class="identifier">piecewise_constant_distribution</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">F</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> IntervalsRange<span class="special">,</span> <span class="keyword">typename</span> WeightsRange<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a396e85c8b1a4887ff778c9818ec8a142"><span class="identifier">piecewise_constant_distribution</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">IntervalsRange</span> <span class="special">&amp;</span><span class="special">,</span> 
                                    <span class="keyword">const</span> <span class="identifier">WeightsRange</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a2826da578a5c21fcda4fc1be1303ed93"><span class="identifier">piecewise_constant_distribution</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">,</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="identifier">F</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">explicit</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1aab344568fae8eef4ffe93a9892fa8b74"><span class="identifier">piecewise_constant_distribution</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> URNG<span class="special">&gt;</span> <span class="identifier">RealType</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a7866a8906328f58ad9d91db670574992"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">URNG</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> URNG<span class="special">&gt;</span> 
    <span class="identifier">RealType</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a319c979ad3d33667693e16aa4577533d"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">URNG</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">result_type</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1afb8bb114a4a3954e91fc5f5508836ee1"><span class="identifier">min</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">result_type</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a1b4d07ae4cf3bde85c32676115f6e9d3"><span class="identifier">max</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">RealType</span> <span class="special">&gt;</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a1b462b2f1dbfc7b17b4689ecdfc87297"><span class="identifier">densities</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">RealType</span> <span class="special">&gt;</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1aedb2f7d9b85b28881b0b2113bd61de6b"><span class="identifier">intervals</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1abb6676dc506091682ebd9e9e7ea95322"><span class="identifier">param</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a72b9cab43180898bee4df0423a5a7d0f"><span class="identifier">param</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a5a327e5c63a2a6b47ce02b59a6b4ff49"><span class="identifier">reset</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#id-1_3_32_5_6_34_1_1_1_7-bb">friend functions</a></span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> CharT<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span> 
    <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span> 
    <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a3789e8b3c98404bbf0c2d3dc1feb4824"><span class="keyword">operator</span><span class="special">&lt;&lt;</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> 
               <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> CharT<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span> 
    <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span> 
    <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a4da5522051781602c861a47f38703072"><span class="keyword">operator</span><span class="special">&gt;&gt;</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">,</span> 
               <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a7f18e4078bb511b715fcadfcbbb1e2bd"><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span><span class="special">,</span> 
                  <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a0f1c705c06016aeb3211c717d2a21dea"><span class="keyword">operator</span><span class="special">!=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span><span class="special">,</span> 
                  <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.32.5.6.33.3.4"></a><h2>Description</h2>
<p>The class <code class="computeroutput"><a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a></code> models a  <a class="link" href="../../boost_random/reference.html#boost_random.reference.concepts.random_distribution" title="Random Distribution">random distribution</a> . </p>
<div class="refsect2">
<a name="id-1.3.32.5.6.33.3.4.3"></a><h3>
<a name="id-1_3_32_5_6_34_1_1_1_6-bb"></a><code class="computeroutput">piecewise_constant_distribution</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a76797fda1e5f8ae0f6f833e542a42f71"></a><span class="identifier">piecewise_constant_distribution</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Creates a new <code class="computeroutput"><a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a></code> with a single interval, [0, 1). </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> IntervalIter<span class="special">,</span> <span class="keyword">typename</span> WeightIter<span class="special">&gt;</span> 
  <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1acce63ef0ad9d3e70e7e36148990341f5"></a><span class="identifier">piecewise_constant_distribution</span><span class="special">(</span><span class="identifier">IntervalIter</span> first_interval<span class="special">,</span> 
                                  <span class="identifier">IntervalIter</span> last_interval<span class="special">,</span> 
                                  <span class="identifier">WeightIter</span> first_weight<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs a <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> from two iterator ranges containing the interval boundaries and the interval weights. If there are less than two boundaries, then this is equivalent to the default constructor and creates a single interval, [0, 1).</p>
<p>The values of the interval boundaries must be strictly increasing, and the number of weights must be one less than the number of interval boundaries. If there are extra weights, they are ignored.</p>
<p>For example,</p>
<pre class="programlisting"><span class="keyword">double</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1aedb2f7d9b85b28881b0b2113bd61de6b"><span class="identifier">intervals</span></a><span class="special">[</span><span class="special">]</span> <span class="special">=</span> <span class="special">{</span> <span class="number">0</span><span class="special">.</span><span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">.</span><span class="number">0</span><span class="special">,</span> <span class="number">4</span><span class="special">.</span><span class="number">0</span> <span class="special">}</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">weights</span><span class="special">[</span><span class="special">]</span> <span class="special">=</span> <span class="special">{</span> <span class="number">1</span><span class="special">.</span><span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">.</span><span class="number">0</span> <span class="special">}</span><span class="special">;</span>
<a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a76797fda1e5f8ae0f6f833e542a42f71"><span class="identifier">piecewise_constant_distribution</span><span class="special">&lt;</span><span class="special">&gt;</span></a> <span class="identifier">dist</span><span class="special">(</span>
    <span class="special">&amp;</span><a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1aedb2f7d9b85b28881b0b2113bd61de6b"><span class="identifier">intervals</span></a><span class="special">[</span><span class="number">0</span><span class="special">]</span><span class="special">,</span> <span class="special">&amp;</span><a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html#doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1aedb2f7d9b85b28881b0b2113bd61de6b"><span class="identifier">intervals</span></a><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="special">&amp;</span><span class="identifier">weights</span><span class="special">[</span><span class="number">0</span><span class="special">]</span><span class="special">)</span><span class="special">;</span>
</pre>
<p>The distribution has a 50% chance of producing a value between 0 and 1 and a 50% chance of producing a value between 1 and 4. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> F<span class="special">&gt;</span> 
  <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1abd80a326c224151118e703771a1c4ade"></a><span class="identifier">piecewise_constant_distribution</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> il<span class="special">,</span> <span class="identifier">F</span> f<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs a <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> from an initializer_list containing the interval boundaries and a unary function specifying the weights. Each weight is determined by calling the function at the midpoint of the corresponding interval.</p>
<p>If the initializer_list contains less than two elements, this is equivalent to the default constructor and the distribution will produce values uniformly distributed in the range [0, 1). </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> IntervalsRange<span class="special">,</span> <span class="keyword">typename</span> WeightsRange<span class="special">&gt;</span> 
  <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a396e85c8b1a4887ff778c9818ec8a142"></a><span class="identifier">piecewise_constant_distribution</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">IntervalsRange</span> <span class="special">&amp;</span> intervals_arg<span class="special">,</span> 
                                  <span class="keyword">const</span> <span class="identifier">WeightsRange</span> <span class="special">&amp;</span> weights_arg<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs a <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> from Boost.Range ranges holding the interval boundaries and the weights. If there are less than two interval boundaries, this is equivalent to the default constructor and the distribution will produce values uniformly distributed in the range [0, 1). The number of weights must be one less than the number of interval boundaries. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> 
  <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a2826da578a5c21fcda4fc1be1303ed93"></a><span class="identifier">piecewise_constant_distribution</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> nw<span class="special">,</span> <span class="identifier">RealType</span> xmin<span class="special">,</span> 
                                  <span class="identifier">RealType</span> xmax<span class="special">,</span> <span class="identifier">F</span> f<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs a <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> that approximates a function. The range of the distribution is [xmin, xmax). This range is divided into nw equally sized intervals and the weights are found by calling the unary function f on the midpoints of the intervals. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">explicit</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1aab344568fae8eef4ffe93a9892fa8b74"></a><span class="identifier">piecewise_constant_distribution</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span> param<span class="special">)</span><span class="special">;</span></pre>
<p>Constructs a <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> from its parameters. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> URNG<span class="special">&gt;</span> <span class="identifier">RealType</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a7866a8906328f58ad9d91db670574992"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">URNG</span> <span class="special">&amp;</span> urng<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a value distributed according to the parameters of the piecewist_constant_distribution. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> URNG<span class="special">&gt;</span> 
  <span class="identifier">RealType</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a319c979ad3d33667693e16aa4577533d"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">URNG</span> <span class="special">&amp;</span> urng<span class="special">,</span> <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span> param<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a value distributed according to the parameters specified by param. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">result_type</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1afb8bb114a4a3954e91fc5f5508836ee1"></a><span class="identifier">min</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the smallest value that the distribution can produce. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">result_type</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a1b4d07ae4cf3bde85c32676115f6e9d3"></a><span class="identifier">max</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the largest value that the distribution can produce. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">RealType</span> <span class="special">&gt;</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a1b462b2f1dbfc7b17b4689ecdfc87297"></a><span class="identifier">densities</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a vector containing the probability density over each interval. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">RealType</span> <span class="special">&gt;</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1aedb2f7d9b85b28881b0b2113bd61de6b"></a><span class="identifier">intervals</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a vector containing the interval boundaries. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1abb6676dc506091682ebd9e9e7ea95322"></a><span class="identifier">param</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the parameters of the distribution. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a72b9cab43180898bee4df0423a5a7d0f"></a><span class="identifier">param</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html" title="Class param_type">param_type</a> <span class="special">&amp;</span> param<span class="special">)</span><span class="special">;</span></pre>
<p>Sets the parameters of the distribution. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a5a327e5c63a2a6b47ce02b59a6b4ff49"></a><span class="identifier">reset</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.32.5.6.33.3.4.4"></a><h3>
<a name="id-1_3_32_5_6_34_1_1_1_7-bb"></a><code class="computeroutput">piecewise_constant_distribution</code> friend functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> CharT<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span> 
  <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span> 
  <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a3789e8b3c98404bbf0c2d3dc1feb4824"></a><span class="keyword">operator</span><span class="special">&lt;&lt;</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span> os<span class="special">,</span> 
             <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span> pcd<span class="special">)</span><span class="special">;</span></pre>
<p>Writes a distribution to a <code class="computeroutput">std::ostream</code>. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> CharT<span class="special">,</span> <span class="keyword">typename</span> Traits<span class="special">&gt;</span> 
  <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span> 
  <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a4da5522051781602c861a47f38703072"></a><span class="keyword">operator</span><span class="special">&gt;&gt;</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special">&lt;</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">&gt;</span> <span class="special">&amp;</span> is<span class="special">,</span> 
             <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span> pcd<span class="special">)</span><span class="special">;</span></pre>
<p>Reads a distribution from a <code class="computeroutput">std::istream</code> </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a7f18e4078bb511b715fcadfcbbb1e2bd"></a><span class="keyword">operator</span><span class="special">==</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span> lhs<span class="special">,</span> 
                <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span> rhs<span class="special">)</span><span class="special">;</span></pre>
<p>Returns true if the two distributions will return the same sequence of values, when passed equal generators. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.headers.classboost_1_1random_1_1piecewise__constant__distribution_1a0f1c705c06016aeb3211c717d2a21dea"></a><span class="keyword">operator</span><span class="special">!=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span> lhs<span class="special">,</span> 
                <span class="keyword">const</span> <a class="link" href="classboost_1_1random_1_1piecewise__constant__distribution.html" title="Class template piecewise_constant_distribution">piecewise_constant_distribution</a> <span class="special">&amp;</span> rhs<span class="special">)</span><span class="special">;</span></pre>
<p>Returns true if the two distributions may return different sequences of values, when passed equal generators. </p>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2000-2005 Jens Maurer<br>Copyright © 2009, 2010 Steven Watanabe<br>Copyright © 2022-2025 Matt
      Borland<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="classboost_1_1random_1_1normal__distribution_1_1param__type.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_random/reference.html#doxygen.headers.piecewise__constant__distribution_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="classboost_1_1random_1_1piecewise__constant__distribution_1_1param__type.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
